package org.example.producer;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/send")
public class producerController {

    @Autowired
    private MqttGateway mqttGateway;

    @RequestMapping("/sendMqtt.do")
    public String sendMqtt(String sendData){
        System.out.println("sendMqtt=====msg:" + sendData);
        mqttGateway.sendToMqtt(sendData,"hello");
        return "OK";
    }

    @RequestMapping("/sendMqtt2.do")
    public String sendDefaultTopicMqtt(String sendData){
        System.out.println("sendDefaultTopicMqtt=====msg:" + sendData);
        mqttGateway.sendDefaultTopicToMqtt(sendData);
        return "OK";
    }
}
